
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类</title>
</head>
<body>
    

    <script>
          // es6 类： 对所有对象具有相同属性和方法的公共抽取、概括。--生产流水线  类产生的实例 -实例对象  类的本质-函数
// 父类
          class User {
            name;
            password;
            constructor(name,password){
                this.name = name;
                this.password = password;
            }
            showName(){
                console.log(this.name); 
            }
            showPassword(){
                console.log(this.password);
            }
          }


        //   子类
        class VipUser extends User{
            // 继承了父类
             // 子类特有的属性
             level;
             constructor(name,password,level){
                super(name,password)
                this.level = level
             }
             showLevel(){
                console.log(this.level);    
             }
        }

          let u = new VipUser("tom","111111","至尊卡")
          u.showName()
          u.showPassword()
          u.showLevel()
          console.log(typeof u);
          console.log(typeof User);//function
          console.log(typeof VipUser);//function
          

    </script>
</body>
</html>